package h_JSON;

import com.alibaba.fastjson.JSON;
import z_Entity.User;

/**
 * JSON的使用
 *
 * @author xuyaxu
 * @date 2022/10/17 22:03
 */
public class JsonDemo {

    public static void main(String[] args) {
        User user = new User(1, "jack", 18, 0);
        // 将实体对象转成 json字符串
        String jsonString = JSON.toJSONString(user);
        // {"age":18,"gender":0,"id":1,"userName":"jack"}
        System.out.println(jsonString);
    }
}
